<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>客户管理系统</title>
</head>
<body>
<h2 align="center">客户列表</h2>
<form action="/customer/query" method="get">
    <label>用户id：</label> <input type="text" name="id" /> <input type="submit" name="submit" value="查询" />
</form>
<a href="add.jsp" target="_blank">添加客户</a>
<table align="center">

    <tr>
        <td width="30" align="center">ID</td>
        <td width="100" align="center">姓名</td>
        <td width="200" align="center">地址</td>
        <td width="100" align="center">电话</td>
        <td width="100" align="center">邮箱</td>
        <td width="100" align="center">状态</td>
        <td width="100" align="center">备注</td>
        <td width="50" align="center">修改</td>
        <td width="50" align="center">删除</td>

    </tr>
    <jsp:useBean id="customers" scope="request" type="java.util.List"/>
    <c:forEach var="customer" items="${customers}">
        <tr>
            <td width="30" align="center">${customer.getId()}</td>
            <td width="100" align="center">${customer.getName()}</td>
            <td width="200" align="center">${customer.getAddress()}</td>
            <td width="100" align="center">${customer.getTelephone()}</td>
            <td width="100" align="center">${customer.getEmail()}</td>
            <td width="100" align="center">${customer.getStatus() == 0? "正常": "封禁"}</td>
            <td width="100" align="center">${customer.getRemark()}</td>
            <td width="50" align="center"><a href="/customer/update?id=${customer.getId()}" target="_blank">修改</a></td>
            <td width="50" align="center">
                <form id="_form_${customer.getId()}" method="post" action="/customer/delete">
                    <input style="width:0px; float:left;" type="hidden" name="id" value="${customer.getId()}" />
                    <a style="width:50px; float:left;" onclick="document.getElementById('_form_' + ${customer.getId()}).submit();">删除</a>
                </form>
            </td>
        </tr>
    </c:forEach>
</table>

</body>
</html>
